GBML manual / Core

profile_average

Like profile_percent, but averaged over the last 32 frames. It changes about twice a second, so it is steady enough to read.

Works differently on Game Boy - The Game Boy has no frame profiler: profile_enabled says false and every profile number reads 0.

Works differently on Game Boy Color - The Game Boy Color has no frame profiler: profile_enabled says false and every profile number reads 0.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

profile_average(phase) -> real

Arguments

NameType
phaseint

Returns

real

Description

The same number as profile_percent, but averaged over the last 32 frames. It changes about twice a second, which is slow enough to read. This is the one to put on screen.

For the first 32 frames after the game starts, it averages however many frames there have been so far.

Example

for (var i = 1; i <= profile_phases(); i++) {
    draw_text(4, 4 + i * 6, $"{profile_name(i)} {int_round(profile_average(i))}");
}

Draws every phase's name and its average cost, as a whole number of percent of one frame, one phase to a line.

On the GBA

During the first 32 frames after the game starts it averages however many frames there have been so far.

See also: profile_percentprofile_worst